import 'dart:math';

import 'package:myturngame/bean/combat/reward.dart';
import 'package:myturngame/bean/role_in_map.dart';
import 'package:myturngame/common/game_global.dart';
import 'package:myturngame/facotry/bag_object_factory.dart';
import 'package:myturngame/facotry/equipment_factory.dart';
import 'package:myturngame/utils/list_extend.dart';

///奖励制造工厂
Reward createReward(RoleInMap roleInMap) {
  if (roleInMap.name == 'enemy001'.enemyName()) {
    var reward = Reward()
      ..exp = 3 + Random().nextInt(3)
      ..money = 2 + Random().nextInt(1);
    var isDrop = Random().nextInt(10) > 5;
    if (isDrop) {
      //掉落列表
      // var list = ['equip001','equip002','equip003','equip004'];
      var list = ['equip005','equip006','equip007','equip008','equip009','equip010','equip011','equip012'];
      reward.bagObject.add(createEquipment(list.random()));
    }
    return reward;
  }else if(roleInMap.name == 'enemy002'.enemyName()){
    var reward = Reward()
      ..exp = 10 + Random().nextInt(5)
      ..money = 5 + Random().nextInt(2);
    var isDrop = Random().nextInt(10) > 9;
    if (isDrop) {
      reward.bagObject.add(createEquipment("神之剑"));
    }
    return reward;
  }else{
    return Reward();
  }
}
